package com.qf.test;

import com.qf.daomain.Linkman;
import com.qf.mapper.LinkmanMapper;
import com.qf.mapper.UserMapper;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import org.junit.Test;

import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;

/**
 * @author 10537
 * @version V1.0
 * @Date 2021/9/26 15:23
 */

public class Demo4 {
    @Test
    public void Test ()throws Exception{
        InputStream inputStream = Resources.getResourceAsStream("mybatis-config.xml");
        SqlSessionFactory build = new SqlSessionFactoryBuilder().build(inputStream);
        SqlSession sqlSession = build.openSession();
        LinkmanMapper mapper = sqlSession.getMapper(LinkmanMapper.class);
        Linkman linkman = mapper.findLinkmanAndCustomerById(4);
        System.out.println(linkman.toString());
        System.out.println(linkman.getCustomer().toString());
    }
}
